package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.hqfinance.domain.HqPaidFlowSheet;
import com.ruoyi.hqfinance.domain.vo.HqPaidFlowSheetVo;
import com.ruoyi.hqfinance.mapper.HqPaidFlowSheetMapper;
import com.ruoyi.hqfinance.service.HqPaidFlowSheetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HqPaidFlowSheetServiceImpl implements HqPaidFlowSheetService {
    @Autowired
    private HqPaidFlowSheetMapper hqPaidFlowSheetMapper;
    @Override
    public List<HqPaidFlowSheet> collect(HqPaidFlowSheetVo vo) {
        PageHelper.startPage(vo.getPageDate());
        List<HqPaidFlowSheet> sheets = hqPaidFlowSheetMapper.collect(vo);
        assert sheets != null;
        for (HqPaidFlowSheet hqPaidFlowSheet : sheets){
            if (vo.getTimeType() == 2){
                hqPaidFlowSheet.setSettleDate(vo.getStartTime() + "至" + vo.getEndTime());
            }
            hqPaidFlowSheet.setWeightPeriod(vo.getStartWeight() + "-" + vo.getEndWeight());
        }
        return sheets;
    }
}
